package com.table;

import com.element.Element;

/* TableElement class represents the members of a table. 
 * Each TableElement consists of an object (of class Element; such as an Item, Monster or Event) */
public class TableElement {
	
	/* -1 == no limit */
	public final static int OCCUR_SIZE_LIMIT = -1;
	
	/* Chance for 1 item to drop */
	private double chance = 0.00;
	
	/* Maximum number of drops for this item */
	private int size = 0;
	
	/* Self explanatory variables */
	private boolean enabled = false;
	private Element element = null;
	private boolean onlyLetThisOccur = false;
	
	public TableElement(Element element, double chance, int size){
		this.chance = chance;
		this.element = element;
		this.size = size;
	}
	
	public TableElement(Element element, double chance, int size, boolean onlyLetThisOccur){
		this(element, chance, size);
		this.onlyLetThisOccur = onlyLetThisOccur;
	}
	
	public Element getElement(){
		return element;
	}
	
	public double getChance(){
		return chance;
	}
	
	public int getSize(){
		return size;
	}
	
	/* enables the current element */
	public void enable(){ 
		enabled = true;
	}
	
	/* disables the current element */
	public void disable(){
		enabled = false;
	}
	
	public boolean isEnabled(){
		return enabled;
	}

	public boolean isOnlyLetThisOccur() {
		return onlyLetThisOccur;
	}

	public void setOnlyLetThisOccur(boolean onlyLetThisOccur) {
		this.onlyLetThisOccur = onlyLetThisOccur;
	}
}